<?php
	/**
	 * @package AmpleHarvest
	 */
	require_once 'TableHeader.php';
	require_once 'cTABLE_Drop_Down_Options.php';
	/**
	 * @brief This class Describes the IRT Table in the AmpleHarvest Database
	 *
	 * - Revision History
	 *  - 0.1
	 * 	 - <b>Date</b>: 28 September 2012
	 * 	 - <b>Author</b>: Jay Novak (jay.novak@iswcorp.com)
	 * 	  - Initial Version
	 *
	 * @author Jay Novak
	 * @version 0.1
	 * @ingroup code classes table
	 */
	class cTABLE_IRT extends cTable
	{
		const C_INT_MAX_RESULTS_RETURNED = 500;
		const C_INT_DEFAULT_RESULTS_RETURNED = 100;
		/**
		 * @{
		 * @name  Columns
		 */
		public $m_int_COL_ID = null;
		public $m_int_COL_UserID = null;
		public $m_int_COL_RequestNum = null;
		public $m_int_COL_DateRequested = null;
		public $m_int_COL_DateUpdated = null;
		public $m_int_COL_UserSID = null;
		
		//TODO: BS - Added OnBehalfOfUserSID
		public $m_int_COL_OnBehalfOfUserSID = null;
		
		public $m_int_COL_UserFullName = null;
		public $m_int_COL_UserPhoneNumber = null;
		public $m_int_COL_UserAffiliation = null;
		public $m_int_COL_SupervisorSid = null;
		public $m_int_COL_CORSID = null;
		public $m_int_COL_ClassAccess = null;
		public $m_int_COL_ClassSCI = null;
		public $m_int_COL_ClassDistro = null;
		public $m_int_COL_GovLeadSID = null;
		
		//TODO: BS - Change to StartDate
// 		public $m_int_COL_SuspenseDate = null;
		public $m_int_COL_StartDate = null;
		
		public $m_int_COL_WebsiteName = null;
		public $m_int_COL_URL = null;
		public $m_int_COL_RequestedResource = null;
		//public $m_int_COL_RequestType = null;
		public $m_int_COL_OpsecConcerns = null;
		public $m_int_COL_PrimaryLanguage = null;
		public $m_int_COL_Urgency = null;
		public $m_int_COL_UrgancyExplanation = null;
		public $m_int_COL_Description = null;
		public $m_int_COL_Justification = null;
		public $m_int_COL_KeyWords = null;
		//public $m_int_COL_Risk = null;
		public $m_int_COL_Frequency = null;
		//public $m_int_COL_DataUsage = null;
		//public $m_int_COL_Sensitivity = null;
		public $m_int_COL_CSourceInfo = null;
		public $m_int_COL_Status = null;
		
		//TODO: BS - Change to StopDate
// 		public $m_int_COL_Duration = null;
		public $m_int_COL_StopDate = null;
		
		public $m_int_COL_CSource = null;
		
		//TODO: BS - added on behalf of check
		public $m_int_COL_IsOnBehalfOf = null;
		
		public $m_int_COL_ForeignLanguage = null;
		public $m_int_COL_ImporterSID = null;
		
		//TODO: BS - added
		public $m_int_COL_DueDate = null;
		public $m_int_COL_CustomFrequency = null;
		
		/**
		 * @}
		 */

		/**
		 * This constructor sets all the required column data
		 */
		public function __construct()
		{
			$this->m_str_TableName = "IRT";
			$this->set_Engine(self::C_STR_ENGINE_INNODB);

			//Create Column Objects
			$obj_COL_ID = new cColVarChar("id");
			$obj_COL_ID->set_Length(36);
			$obj_COL_ID->set_Index(abs_Column::c_int_INDEX_PRIMARY);
			$obj_COL_ID->set_Comment("This column holds the ID of the requests.");
			$obj_COL_ID->set_Editable(false);
			$obj_COL_ID->set_Label("ID");
			
			$obj_COL_UserID = new cColVarChar("user_id");
			$obj_COL_UserID->set_Length(36);
			$obj_COL_UserID->set_Comment("This column holds the user GUID.");
			$obj_COL_UserID->set_Label("User GUID");
			
			$obj_COL_RequestNum = new cColInt("requestNum");
			$obj_COL_RequestNum->set_Comment("This column holds the Request Number.");
			$obj_COL_RequestNum->set_Label("Request #");
			
			$obj_COL_DateRequested = new cColDateTime("date_requested");
			$obj_COL_DateRequested->set_Comment("This column holds the last run time.");
			$obj_COL_DateRequested->set_Label("Date Requested");
			
			$obj_COL_DateUpdated = new cColDateTime("date_updated");
			$obj_COL_DateUpdated->set_Comment("This column holds the next run time.");
			$obj_COL_DateUpdated->set_Label("Date Updated");
			
			$obj_COL_UserSID = new cColVarChar("user_sid");
			$obj_COL_UserSID->set_Length(36);
			$obj_COL_UserSID->set_Comment("This column holds the user SID.");
			$obj_COL_UserSID->set_Label("User SID");
			
			//TODO: BS - Added OnBehalfOfUserSID
			$obj_COL_OnBehalfOfUserSID = new cColVarChar("on_behalf_of_user_sid");
			$obj_COL_OnBehalfOfUserSID->set_Length(36);
			$obj_COL_OnBehalfOfUserSID->set_Comment("This column holds the on behalf of user SID.");
			$obj_COL_OnBehalfOfUserSID->set_Label("On Behalf Of User SID");
			
			$obj_COL_UserFullName = new cColVarChar("user_full_name");
			$obj_COL_UserFullName->set_Length(36);
			$obj_COL_UserFullName->set_Comment("This column holds the Full Name of the requester.");
			$obj_COL_UserFullName->set_Label("User Full Name");
			
			$obj_COL_UserPhoneNumber = new cColVarChar("user_phone_number");
			$obj_COL_UserPhoneNumber->set_Length(36);
			$obj_COL_UserPhoneNumber->set_Comment("This column holds the phone number of the requester.");
			$obj_COL_UserPhoneNumber->set_Label("User phone number");
			
			$obj_COL_UserAffiliation = new cColVarChar("user_affiliation");
			$obj_COL_UserAffiliation->set_Length(17);
			$obj_COL_UserAffiliation->set_Comment("This column holds the affiliation of the requester.");
			$obj_COL_UserAffiliation->set_Label("User Affiliation");
			
			$obj_COL_SupervisorSID = new cColVarChar("supervisor_sid");
			$obj_COL_SupervisorSID->set_Length(36);
			$obj_COL_SupervisorSID->set_Comment("This column holds the supervisor SID.");
			$obj_COL_SupervisorSID->set_Label("Supervisor SID");
			
			$obj_COL_CORSID = new cColVarChar("cor_sid");
			$obj_COL_CORSID->set_Length(36);
			$obj_COL_CORSID->set_Comment("This column holds the CORs SID.");
			$obj_COL_CORSID->set_Label("COR SID");
			
			$obj_COL_ClassAccess = new cColVarChar("classification");
			$obj_COL_ClassAccess->set_Length(36);
			$obj_COL_ClassAccess->set_Comment("This column holds the classification of the Request.");
			$obj_COL_ClassAccess->set_Label("Classification");
			
			$obj_COL_ClassSCI = new cColVarChar("sci");
			$obj_COL_ClassSCI->set_Length(100);
			$obj_COL_ClassSCI->set_Comment("This column holds the SCI portion of the classification of the Request.");
			$obj_COL_ClassSCI->set_Label("SCI");
			
			$obj_COL_ClassDistro = new cColVarChar("distro");
			$obj_COL_ClassDistro->set_Length(100);
			$obj_COL_ClassDistro->set_Comment("This column holds the Distro portion of the classification of the Request.");
			$obj_COL_ClassDistro->set_Label("Distro");
			
			$obj_COL_GovLeadSID = new cColVarChar("gov_lead_sid");
			$obj_COL_GovLeadSID->set_Length(36);
			$obj_COL_GovLeadSID->set_Comment("This column holds the government leads SID.");
			$obj_COL_GovLeadSID->set_Label("Governmet Lead SID");
			
			//TODO: BS - Remove dead code
// 			$obj_COL_SuspenseDate = new cColDateTime("suspense_date");
// 			$obj_COL_SuspenseDate->set_Comment("This column holds the suspense date.");
// 			$obj_COL_SuspenseDate->set_Label("Suspense Date");
			$obj_COL_StartDate = new cColDateTime("start_date");
			$obj_COL_StartDate->set_Comment("This column holds the start date of when the import should begin.");
			$obj_COL_StartDate->set_Label("Start Date");
			
			$obj_COL_WebsiteName = new cColVarChar("website_name");
			$obj_COL_WebsiteName->set_Length(100);
			$obj_COL_WebsiteName->set_Comment("This column holds the website name.");
			$obj_COL_WebsiteName->set_Label("Website Name");
			
			$obj_COL_URL = new cColText("url");
			$obj_COL_URL->set_Comment("This column holds the Target URL.");
			$obj_COL_URL->set_Label("Source URL");
			
			$obj_COL_RequestedResource = new cColVarChar("requested_resource");
			$obj_COL_RequestedResource->set_Length(20);
			$obj_COL_RequestedResource->set_Comment("This column holds the requested resource.");
			$obj_COL_RequestedResource->set_Label("Requested Resource");
			
			/*
			$obj_COL_RequestType = new cColVarChar("type");
			$obj_COL_RequestType->set_Length(15);
			$obj_COL_RequestType->set_Comment("This column holds the target type description.");
			$obj_COL_RequestType->set_Label("Source Type");
			*/
			
			$obj_COL_OpsecConcerns = new cColVarChar("opsec_concerns");
			$obj_COL_OpsecConcerns->set_Length(6);
			$obj_COL_OpsecConcerns->set_Comment("This column holds any opsec concerns.");
			$obj_COL_OpsecConcerns->set_Label("Opsec Concerns");
			
			$obj_COL_PrimaryLanguage = new cColVarChar("language");
			$obj_COL_PrimaryLanguage->set_Length(45);
			$obj_COL_PrimaryLanguage->set_Comment("This column holds the URL target language.");
			$obj_COL_PrimaryLanguage->set_Label("Language");
			
			
			//primaryLANGUAGE
			
			$obj_COL_Urgency = new cColVarChar("urgency");
			$obj_COL_Urgency->set_Length(15);
			$obj_COL_Urgency->set_Comment("This column holds the urgency of the request.");
			$obj_COL_Urgency->set_Label("Request Urgency");
			
			$obj_COL_UrgencyExplanation = new cColText("urgency_explanation");
			$obj_COL_UrgencyExplanation->set_Comment("This column holds the explanation for the urgency of the request.");
			$obj_COL_UrgencyExplanation->set_Label("Request Urgency Explanation");
			
			$obj_COL_Description = new cColText("description");
			$obj_COL_Description->set_Comment("This column holds the request description.");
			$obj_COL_Description->set_Label("Description");
				
			$obj_COL_Justification = new cColText("justification");
			$obj_COL_Justification->set_Comment("This column holds the justification of the request.");
			$obj_COL_Justification->set_Label("Request Justification");
			
			//Custom frequency description
			$obj_COL_CustomFrequency = new cColText("custom_frequency");
			$obj_COL_CustomFrequency->set_Comment("This column holds information pertaining to the custom frequency request.");
			$obj_COL_CustomFrequency->set_Label("Custom Frequency");
			
			$obj_COL_KeyWords = new cColText("key_words");
			$obj_COL_KeyWords->set_Comment("This column holds the key words for the request.");
			$obj_COL_KeyWords->set_Label("Keywords");
			
			/*
			$obj_COL_Risk = new cColText("risk");
			$obj_COL_Risk->set_Comment("This column holds the risk level.");
			$obj_COL_Risk->set_Label("Risk");
			*/
			
			$obj_COL_Frequency = new cColVarChar("frequency");
			$obj_COL_Frequency->set_Length(7);
			$obj_COL_Frequency->set_Comment("This column holds the harvest frequency.");
			$obj_COL_Frequency->set_Label("Frequency");

			/*
			$obj_COL_DataUsage = new cColVarChar("data_usage");
			$obj_COL_DataUsage->set_Length(25);
			$obj_COL_DataUsage->set_Comment("This column holds the data_usage of the request.");
			$obj_COL_DataUsage->set_Label("Data Usage");
			*/
			
			/*
			$obj_COL_Sensitivity = new cColSmallInt("sensitivity");
			$obj_COL_Sensitivity->set_Comment("This column holds the sensitivity level.");
			$obj_COL_Sensitivity->set_Label("Sensitive");
			*/
			
			$obj_COL_CSourceInfo = new cColText("c_source_info");
			$obj_COL_CSourceInfo->set_Comment("This column holds the class source information.");
			$obj_COL_CSourceInfo->set_Label("Class Source Information");
			
			//TODO: BS - Added is on behalf of
			$obj_COL_IsOnBehalfOf = new cColText("is_on_behalf_of");
			$obj_COL_IsOnBehalfOf->set_Comment("This column holds if this request was submitted on behalf of another person.");
			$obj_COL_IsOnBehalfOf->set_Label("Is On Behalf Of");
			
			//TODO: BS - Remove dead code			
// 			$obj_COL_Duration = new cColDateTime("duration");
// 			$obj_COL_Duration->set_Comment("This column holds the duration information.");
// 			$obj_COL_Duration->set_Label("Duration");
			$obj_COL_StopDate = new cColDateTime("stop_date");
			$obj_COL_StopDate->set_Comment("This column holds the stop date of when the import should end.");
			$obj_COL_StopDate->set_Label("Stop Date");
			
			$obj_COL_DueDate = new cColDateTime("due_date");
			$obj_COL_DueDate->set_Comment("This column holds the first date of when the import is needed by.");
			$obj_COL_DueDate->set_Label("Due Date");
			
			$obj_COL_Status = new cColTinyInt("status");
			$obj_COL_Status->set_Length(4);
			$obj_COL_Status->set_Comment("This column holds the status of the request.");
			$obj_COL_Status->set_Label("Status");
			
			$obj_COL_CSource = new cColTinyInt("c_source");
			$obj_COL_CSource->set_Length(4);
			$obj_COL_CSource->set_Comment("This column holds the c source.");
			$obj_COL_CSource->set_Label("C Source");
			
			$obj_COL_ForeignLanguage = new cColText("foreign_language");
			$obj_COL_ForeignLanguage->set_Comment("This column holds the foreign language.");
			$obj_COL_ForeignLanguage->set_Label("Foreign Language");
			
			$obj_COL_ImporterSID = new cColVarChar("importer_sid");
			$obj_COL_ImporterSID->set_Length(36);
			$obj_COL_ImporterSID->set_Comment("This column holds the importer SID.");
			$obj_COL_ImporterSID->set_Label("Importer SID");
			
			//Set up connection
			$this->m_obj_Connection = new cConnection("AmpleHarvest", "admin");

			//Activate all Debug options
			$this->m_obj_Connection->set_DebugLevel(cLog_Connection_Debug::c_int_LEVEL_HIDDEN);
			$this->m_obj_Connection->set_LogLevel(cLog_Connection::c_int_LEVEL_BASIC);
			//			$this->m_obj_Connection->activate_Logging();
			//			$this->m_obj_Connection->activate_LogDebug();
			//			$this->m_obj_Connection->activate_ScreenDebug();

			$this->m_int_COL_ID = $this->add_Column($obj_COL_ID);
			$this->m_int_COL_UserID = $this->add_Column($obj_COL_UserID);
			$this->m_int_COL_RequestNum = $this->add_Column($obj_COL_RequestNum);
			$this->m_int_COL_DateRequested = $this->add_Column($obj_COL_DateRequested);
			$this->m_int_COL_DateUpdated = $this->add_Column($obj_COL_DateUpdated);
			$this->m_int_COL_UserSID = $this->add_Column($obj_COL_UserSID);
			
			//TODO: BS - Added OnBehalfOfUserSID 
			$this->m_int_COL_OnBehalfOfUserSID = $this->add_Column($obj_COL_OnBehalfOfUserSID);
			
			$this->m_int_COL_UserFullName = $this->add_Column($obj_COL_UserFullName);
			$this->m_int_COL_UserPhoneNumber = $this->add_Column($obj_COL_UserPhoneNumber);
			$this->m_int_COL_UserAffiliation = $this->add_Column($obj_COL_UserAffiliation);
			$this->m_int_COL_SupervisorSid = $this->add_Column($obj_COL_SupervisorSID);
			$this->m_int_COL_CORSID = $this->add_Column($obj_COL_CORSID);
			$this->m_int_COL_ClassAccess = $this->add_Column($obj_COL_ClassAccess);
			$this->m_int_COL_ClassSCI = $this->add_Column($obj_COL_ClassSCI);
			$this->m_int_COL_ClassDistro = $this->add_Column($obj_COL_ClassDistro);
			$this->m_int_COL_GovLeadSID = $this->add_Column($obj_COL_GovLeadSID);
			
			//TODO: BS - Remove dead code			
// 			$this->m_int_COL_SuspenseDate = $this->add_Column($obj_COL_SuspenseDate);
			$this->m_int_COL_StartDate = $this->add_Column($obj_COL_StartDate);
			
			$this->m_int_COL_WebsiteName = $this->add_Column($obj_COL_WebsiteName);
			$this->m_int_COL_URL = $this->add_Column($obj_COL_URL);
			$this->m_int_COL_RequestedResource = $this->add_Column($obj_COL_RequestedResource);
			//$this->m_int_COL_RequestType = $this->add_Column($obj_COL_RequestType);
			$this->m_int_COL_OpsecConcerns = $this->add_Column($obj_COL_OpsecConcerns);
			$this->m_int_COL_PrimaryLanguage = $this->add_Column($obj_COL_PrimaryLanguage);
			$this->m_int_COL_Urgency = $this->add_Column($obj_COL_Urgency);
			$this->m_int_COL_UrgancyExplanation = $this->add_Column($obj_COL_UrgencyExplanation);
			$this->m_int_COL_Description = $this->add_Column($obj_COL_Description);
			$this->m_int_COL_Justification = $this->add_Column($obj_COL_Justification);
			$this->m_int_COL_KeyWords = $this->add_Column($obj_COL_KeyWords);
			//$this->m_int_COL_Risk = $this->add_Column($obj_COL_Risk);
			$this->m_int_COL_Frequency = $this->add_Column($obj_COL_Frequency);
			//$this->m_int_COL_DataUsage = $this->add_Column($obj_COL_DataUsage);
			//$this->m_int_COL_Sensitivity = $this->add_Column($obj_COL_Sensitivity);
			$this->m_int_COL_CSourceInfo = $this->add_Column($obj_COL_CSourceInfo);
			$this->m_int_COL_Status = $this->add_Column($obj_COL_Status);
			
			//TODO: BS - Remove dead code			
// 			$this->m_int_COL_Duration = $this->add_Column($obj_COL_Duration);
			$this->m_int_COL_StopDate = $this->add_Column($obj_COL_StopDate);

			//TODO: BS-ADDED
			$this->m_int_COL_DueDate = $this->add_Column($obj_COL_DueDate);
			$this->m_int_COL_CustomFrequency = $this->add_Column($obj_COL_CustomFrequency);
				
			$this->m_int_COL_CSource = $this->add_Column($obj_COL_CSource);
			
			//TODO: BS - Added is on behalf of - m_int_COL_IsOnBehalfOf
			$this->m_int_COL_IsOnBehalfOf = $this->add_Column($obj_COL_IsOnBehalfOf);
			
			$this->m_int_COL_ForeignLanguage = $this->add_Column($obj_COL_ForeignLanguage);
			$this->m_int_COL_ImporterSID = $this->add_Column($obj_COL_ImporterSID);
			
			
		}

		/**
		 * Saves Information to the Database
		 *
		public function save_Data2DB()
		{
			//$this->set_ColumnValue($this->m_int_COL_DateUpdated, date("Y/m/d H:i:s"));

			if ($this->validate_ID($this->get_id()))
			{
				print("UPDATE");
				return $this->update_Data2DB();
			}
			else
			{
				print("insert");
				return $this->insert_Data2DB();
			}
			
		}*/
		/**
		 * This function is used to update data that is already in the database
		 */
		public function update_Data2DB()
		{
			/*
			$this->add_ColumnQuery($this->m_int_COL_ID, $this->get_id());
			if ($this->do_Search() > 0)
			{
				$obj_RS = $this->get_ResultSet();

				$this->set_date_requested($obj_RS[0][$this->get_Column_Name($this->m_int_COL_DateRequested)]);
			}
			*/

			//$this->clear_Update();
			//$this->add_ColumnQuery($this->m_int_COL_ID, $this->get_id());
			$this->set_date_updated(date_format(new DateTime(), "Y-m-d H:i:s"));

			return parent::update_Data2DB();
		}
		/**
		 * This function is used to insert Data into the database
		 */
		public function insert_Data2DB()
		{
			$this->add_Sort($this->m_int_COL_RequestNum, cConnection::c_str_SORT_DESC);
			if ($this->do_Search() > 0)
			{
				$obj_RS = $this->get_ResultSet();
				$this->set_requestNum(($obj_RS[0][$this->get_Column_Name($this->m_int_COL_RequestNum)]) + 1);
			}
			else
			{
				$this->set_requestNum(0);
			}
			$this->set_id($this->create_GUID());
			$this->set_date_requested(date_format(new DateTime(), "Y-m-d H:i:s"));
			//print('here');
			return parent::insert_Data2DB();
		}

		/**
		 * Returns if the id is a valid and existing ID
		 * @param string $str_User_ID ID of the Harvest Request to check (GUID)
		 * @return boolean true if valid false if not
		 */
		public function validate_ID($str_ID)
		{
			// ensure that there is an ID passed and that it is a valid GUID
			if (!empty($str_ID) && preg_match(self::c_REG_GUID_VALID, $str_ID))
			{
				$this->clear_Query();
				$this->add_ColumnQuery($this->m_int_COL_ID, $str_ID);
				if ($this->do_Search() > 0)
				{
					return true;
				}
			}
			return false;
		}

		/**
		 * Loads information into object from Database based on ID passed
		 * @param string $str_ID ID of the Query to check (GUID)
		 * return boolean true if loaded false if not
		 */
		public function load_DataFromID($str_ID)
		{
			$this->clear();

			if (!empty($str_ID) && preg_match(self::c_REG_GUID_VALID, $str_ID))
			{
				$this->clear_Query();
				$this->add_ColumnQuery($this->m_int_COL_ID, $str_ID);
				if ($this->do_Search() > 0)
				{
					$obj_RS = $this->get_ResultSet();
					if ($obj_RS[0])
					{
						$this->load_DataFromArray($obj_RS[0]);
						return true;
					}
				}
			}
			return false;
		}
		/**
		 * Check the validity of the data about to be saved
		 * @since 0.1.1
		 * return boolean
		 */
		public function validate_New()
		{

			return true;
			//to-do:What other fields must be entered for this to be valid? 
			if (!$this->get_url())
			{
				return false;
			}
			if (!$this->get_description())
			{
				return false;
			}
			return true;
		}
		
		/**
		 * overrides parent method to add additional info from join tables:
		 *   Status Label as StatusLabel
		 *   User Name as UserName
		 */
		public function get_ResultSet() {
			$result = parent::get_ResultSet();
			$result = $this->setupStatusLabels($result); //TODO do this in initial query using a join
			//$result = $this->setupUserNames($result); //TODO do this in initial query using a join
			
			return $result;
		}
		
		private function setupUserNames($arr_TempRS) {
			$obj_Table_Users = new cTABLE_Users();
				
			foreach($arr_TempRS as &$result) {
				$name = $obj_Table_Users->get_UserNameFromID($result['user_id']);
				//print('here'.$result['user_id'].$name);
				$result['user_id'] = $name;
			}
				
			return $arr_TempRS;
		}
		
		/**
		 *
		 * @param array $arr_TempRS harvest request result set that includes the status column for each item
		 * @return the harvest request result set with an added StatusLabel field for each item
		 */
		private function setupStatusLabels($arr_TempRS) {
			$keyToValue = $this->getStatusValueToLabels();
		
			foreach($arr_TempRS as &$result) {
				$result['StatusLabel'] = $keyToValue[$result['status']];
			}
				
			return $arr_TempRS;
		}
		
		/**
		 * build up mapping between Status Value and Status Label
		 * @return array mapping status dropdown value to label
		 */
		private function getStatusValueToLabels() {
			$obj_Table_DropDownOptions = new cTABLE_Drop_Down_Options();
			$statusValues = $obj_Table_DropDownOptions->getAllValuesForType(cTABLE_Drop_Down::C_STR_DROPDOWN_HR_STATUS);
				
			$keyToValue = array();
			foreach($statusValues as $status) {
				$keyToValue[$status['value']] = $status['label'];
			}
				
			return $keyToValue;
		}
		
		/**
		 * Convert a Status Value into the Status Label
		 * @param string $str_Value Value of the status to convert
		 * @return string the Label Attatched to the Value if available
		 */
		public function convert_StatusValue2Label($str_Value)
		{
			$obj_Table_DropDownOptions = new cTABLE_Drop_Down_Options();
			return $obj_Table_DropDownOptions->convert_Value2Label(cTABLE_Drop_Down::C_STR_DROPDOWN_HR_STATUS, $str_Value);
		}
		
		/**
		 * Gets the Status of the current Request in Text Form
		 * @return string Lable attatched to the current Status Value
		 */
		public function get_StatusTxt()
		{
			return $this->convert_StatusValue2Label($this->get_status());
		}
		
		/**
		 * Default Function to merge data from an array note Array key must match the column name
		 * @param array $arr_Data
		 */
		public function merge_DataFromArray($arr_Data)
		{
			foreach ($arr_Data as $key => $data)
			{
				$func_Call = "set_" . $key;
				//$data = $this->find_Data($arr_Data, $key);
				$this->$func_Call($data);
			}
		}

	}
?>
